home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / game / patch / jst32b_dev.lha / jst_dev / sources / jst / gp_macros.i next >
Text File  |  2000-03-31  |  17KB  |  622 lines

  1.     IFND    GP_MACROS_I_INCLUDED
  2. GP_MACROS_I_INCLUDED    =    1
  3.  
  4.     include    "osemu.i"
  5.  
  6.     MC68000
  7.  
  8. ; ** currently used disk sizes
  9.  
  10. STD_DISK_SIZE = 901120    ; standard dos copiable disks
  11. B12_DISK_SIZE = 970752    ; 12 sectored 79 tracks disks, dos bootblock
  12. S12_DISK_SIZE = 983040    ; 12 sectored 79 tracks disks, dos bootblock
  13.  
  14. ; ** Tooltype/argument definitions
  15.  
  16. ; bits
  17.  
  18. AFB_NTSC = 0
  19. AFB_LOWMEM = 1
  20. AFB_HDLOAD = 2
  21. AFB_TRAINER = 3
  22. AFB_NOOSSWAP = 4
  23. AFB_JOYPAD = 5
  24.  
  25. ; ** joypad button definitions (for JoyButtonsState)
  26.  
  27. ; ** masks
  28.  
  29. AFF_FIRE1 = $20        ; red joypad button
  30. AFF_START = $01        ; start/pause joypad button
  31. AFF_FIRE2 = $40        ; blue joypad button
  32. AFF_FIRE4 = $08        ; green joypad button
  33. AFF_FIRE3 = $10        ; yellow joypad button
  34. AFF_FORWD = $04        ; forward joypad key
  35. AFF_BACWD = $02        ; back joypad key
  36.  
  37. ; ** bits
  38.  
  39. AFB_START = $0        ; start/pause joypad button
  40. AFB_BACWD = $1        ; back joypad key
  41. AFB_FORWD = $2        ; forward joypad key
  42. AFB_FIRE4 = $3        ; green joypad button
  43. AFB_FIRE3 = $4        ; yellow joypad button
  44. AFB_FIRE1 = $5        ; red joypad button
  45. AFB_FIRE2 = $6        ; blue joypad button
  46.  
  47.  
  48. STORE_REGS: MACRO
  49.     IFLE    NARG
  50.     movem.l    D0-D7/A0-A6,-(A7)
  51.     ELSE
  52.     movem.l    \1,-(A7)
  53.     ENDC
  54.     ENDM
  55.  
  56. RESTORE_REGS: MACRO
  57.     IFLE    NARG
  58.     movem.l    (A7)+,D0-D7/A0-A6
  59.     ELSE
  60.     movem.l    (A7)+,\1
  61.     ENDC
  62.     ENDM
  63.  
  64. WAIT_LMB: MACRO
  65. .wl\@
  66.     btst    #6,$BFE001
  67.     bne    .wl\@
  68.     ENDM
  69.  
  70. WAIT_JOY: MACRO
  71. .wj\@
  72.     btst    #7,$BFE001
  73.     bne    .wj\@
  74.     ENDM
  75.  
  76. GETLVO:MACRO
  77.     move.l    #_LVO\1,D0
  78.     ENDM
  79.  
  80. ; ******* Print/Printf ********
  81. ; Because of buggy Barfly macro argument count,
  82. ; I had to make 2 functions for BARFLY for each Mac_printf and Mac_printh
  83. ;
  84. ; Mac_printf : same as before
  85. ; Mac_print  : no linefeed (same as Mac_printf "string",*anything* , except
  86. ; Barfly does not work properly with it, and as I now use Barfly for JST
  87. ; it's annoying)
  88. ;
  89. ; Mac_printh : same as before
  90. ; Mac_printx : Mac_printh without linefeed
  91.  
  92.     IFD    BARFLY
  93.  
  94. Mac_print: MACRO
  95.  
  96.     move.l    A1,-(A7)
  97.     lea    .text\@(PC),A1
  98.     JSRABS    Display
  99.  
  100.     bra    .ftext\@
  101. .text\@
  102.     dc.b    "\1",0
  103.     even
  104.  
  105. .ftext\@
  106.     move.l    (A7)+,A1
  107.     ENDM
  108.  
  109. Mac_printf: MACRO
  110.     Mac_print    <\1>
  111.     NEWLINE
  112.     ENDM
  113.  
  114. Mac_printh: MACRO
  115.     Mac_printx    \1
  116.     NEWLINE
  117.     ENDM
  118.  
  119. Mac_printx:MACRO
  120.     movem.l    D0/A1,-(A7)
  121.     move.l    \1,D0
  122.     lea    .text\@(PC),A1
  123.     JSRABS    HexToString
  124.     JSRABS    Display
  125.     bra    .ftext\@
  126.  
  127. .text\@
  128.     dc.b    "$00000000",0
  129.     even
  130. .ftext\@
  131.     movem.l    (A7)+,D0/A1
  132.     ENDM
  133.  
  134.     ELSE
  135.  
  136. ; *** macro definitions for other assemblers than Barfly
  137.  
  138. ; ******* Macro Printf ********
  139. ; Mac_printf "text"   -> text + linefeed
  140. ; Mac_printf "text",*any argument* -> text without linefeed
  141.  
  142. Mac_printf: MACRO
  143.  
  144.     move.l    A1,-(A7)
  145.     lea    .text\@(PC),A1
  146.     JSRABS    Display
  147.     bra    .ftext\@
  148. .text\@
  149.     IFD    MAXON_ASM
  150.         dc.b    "\1"
  151.     ELSE
  152.         IFD    BARFLY
  153. ;;            dc.b    "\1"
  154.         ELSE
  155.             DC.B    \1
  156.         ENDIF
  157.     ENDIF
  158.     
  159.     IFLE    NARG-1
  160.     dc.b    10,13
  161.     ENDC
  162.     dc.b    0
  163.     even
  164.  
  165. .ftext\@
  166.     move.l    (A7)+,A1
  167.     ENDM
  168.  
  169. Mac_print:MACRO
  170.     Mac_printf    \1,v
  171.     ENDM
  172.  
  173. ; ******* Macro Printh ********
  174. ; Mac_printh <expr>   -> hex number + linefeed
  175. ; Mac_printh <expr>,*any argument* -> without linefeed
  176.  
  177. Mac_printh: MACRO
  178.  
  179.     movem.l    D0/A1,-(A7)
  180.     move.l    \1,D0
  181.     lea    .text\@(PC),A1
  182.     JSRABS    HexToString
  183.     JSRABS    Display
  184.     bra    .ftext\@
  185.  
  186. .text\@
  187.     dc.b    "$00000000"
  188.     IFLE    NARG-1
  189.     dc.b    10,13
  190.     ENDC
  191.     dc.b    0
  192.     even
  193. .ftext\@
  194.     movem.l    (A7)+,D0/A1
  195.     ENDM
  196.  
  197.     ENDC
  198.  
  199. PUTS: MACRO
  200.     move.l    A1,-(A7)
  201.     lea    \1,A1
  202.     JSRABS    Display
  203.     move.l    (A7)+,A1
  204.     ENDM
  205.  
  206. NEWLINE: MACRO
  207.     JSRABS    NewLine
  208.     ENDM
  209.  
  210.  
  211.  
  212. STOP_SOUND:MACRO
  213.     move.w    #$000F,dmacon+$DFF000
  214.     move.w    #$0000,aud0+ac_len+$DFF000
  215.     move.w    #$0000,aud1+ac_len+$DFF000
  216.     move.w    #$0000,aud2+ac_len+$DFF000
  217.     move.w    #$0000,aud3+ac_len+$DFF000
  218.     ENDM
  219.  
  220. MAKE_ABS_REFS:MACRO
  221.  
  222.     ; *** Non-relocated routines. call normally with JSR
  223.     ; *** don't call them with JSRGEN, this would not compile (better than crash)
  224.  
  225.     DEF_\1_ABS    CloseAll,0        ; quit program (while the OS is up)
  226.     DEF_\1_ABS    CloseAllQuiet,1        ; quit program and close window
  227.     DEF_\1_ABS    LoadDisks,2        ; load diskfiles
  228.     DEF_\1_ABS    LoadDiskFromName,3    ; load a disk
  229.     DEF_\1_ABS    LoadDisksIndex,4    ; load a disk, starting from number D0
  230.     DEF_\1_ABS    LoadFiles,5        ; load files in the directory
  231.     DEF_\1_ABS    LoadSmallFiles,6    ; load small files (<D0)
  232.     DEF_\1_ABS    Kick37Test,7        ; check if Kickstart version <37
  233.     DEF_\1_ABS    KickVerTest,8        ; check against a given kick version
  234.     DEF_\1_ABS    GetMemFlag,9        ; returns MEMF_REVERSE flag isf available
  235.     DEF_\1_ABS    FlushCachesSys,10    ; flush caches using CacheClearU()
  236.     DEF_\1_ABS    Enhance,11        ; restores everything (caches, display)
  237.     DEF_\1_ABS    Degrade,12        ; degrades everything
  238.     DEF_\1_ABS    DegradeCpu,13        ; degrades only CPU related stuff
  239.     DEF_\1_ABS    DegradeGfx,14        ; degrades only GFX related stuff
  240.     DEF_\1_ABS    TransfRoutines,15    ; *** obsolete ***
  241.     DEF_\1_ABS    SaveOSData,16        ; saves OS data (mem,CIAs,custom...)
  242.     DEF_\1_ABS    TestFile,17        ; check if a file is here (game path)
  243.     DEF_\1_ABS    Display,18        ; display a string pointed by A1
  244.     DEF_\1_ABS    LoadRNCFile,19        ; load a RNC file and unpack it
  245.     DEF_\1_ABS    AllocExtMem,20        ; allocate extension memory
  246.     DEF_\1_ABS    Test1MBChip,21        ; check against 1MB of chip (at least)
  247.     DEF_\1_ABS    Test2MBChip,22        ; check against 2MB of chip
  248.     DEF_\1_ABS    Reboot,23        ; reboots :-), only works when OS is alive!
  249.     DEF_\1_ABS    WaitReturn,24        ; waits for the user to press return key
  250.     DEF_\1_ABS    BlockFastMem,25        ; * allocates all fastmem. Do not use :-)
  251.     DEF_\1_ABS    CheckFastMem,26        ; checks if the computer has got fast memory
  252.     DEF_\1_ABS    SupervisorMode,27    ; goes into supervisor mode
  253.     DEF_\1_ABS    UserMode,28        ; goes into user mode
  254.     DEF_\1_ABS    Alloc24BitMem,29    ; allocate extension memory, 24 bit area only
  255.     DEF_\1_ABS    OpenFakeExec,30        ; allocate table for fake exec
  256.     DEF_\1_ABS    SetFilesPath,31        ; change default file path
  257.     DEF_\1_ABS    TestDirectory,32    ; test directory presence (game path)
  258.     DEF_\1_ABS    TestDirectoryAbs,33    ; test directory presence (absolute path)
  259.     DEF_\1_ABS    TestFileAbs,34        ; test file presence (absolute path)
  260.     DEF_\1_ABS    SetLocalVarZone,35    ; save start-end of local object variables
  261.     DEF_\1_ABS    InitLogPatch,36        ; initialize patch logging (private function)
  262.     DEF_\1_ABS    TestAssign,37        ; test assign presence
  263.     DEF_\1_ABS    AllocateTheMemory,38    ; AllocMem with ressource-tracking
  264.     DEF_\1_ABS    FreeTheMemory,39    ; AllocMem with ressource-tracking
  265.     DEF_\1_ABS    HexToString,40        ; HexToString, absolute call
  266.     DEF_\1_ABS    UseHarryOSEmu,41    ; Tell JST to use Harry's great OS emu
  267.     DEF_\1_ABS    NewLine,42        ; Prints a newline
  268.     DEF_\1_ABS    DisableChipmemGap,43    ; Will allow LOWMEM with 2MB chip
  269.     DEF_\1_ABS    GetFileLength,44    ; Returns the length of a file on disk
  270.     DEF_\1_ABS    CloseAllWithError,45    ; internal - do not use
  271.     DEF_\1_ABS    LogChipMirror,46    ; internal - do not use
  272.     DEF_\1_ABS    LogCustomMirror,47    ; internal - do not use
  273.     DEF_\1_ABS    LogExtMemory,48        ; internal - do not use
  274.     DEF_\1_ABS    LogRegisters,49        ; internal - do not use
  275.     DEF_\1_ABS    DisableMMU,50        ; internal - do not use
  276.     DEF_\1_ABS    SetClockLoad,51        ; internal - do not use
  277.     DEF_\1_ABS    Unsupported2,52        ; future use
  278.     DEF_\1_ABS    Unsupported3,53        ; future use
  279.     DEF_\1_ABS    Unsupported4,54        ; future use
  280.     DEF_\1_ABS    Unsupported5,55        ; future use
  281.     DEF_\1_ABS    Unsupported6,56        ; future use
  282.     DEF_\1_ABS    Unsupported7,57        ; future use
  283.     DEF_\1_ABS    Unsupported8,58        ; future use
  284.  
  285.     ENDM
  286.     
  287.     ; *** Relocated routines. always call with JSRGEN (see macros.i)
  288.     ; *** from user program. It works with JSR but if the OS is killed
  289.     ; *** JSRGEN is safer as it jumps in the allocated block
  290.     ; *** which is in the top of memory (MEMF_REVERSE) if kick > 38
  291.     ; *** fast memory is used when found, else chipmem is used
  292.     ; ***
  293.     ; *** I also included a short description of the routines
  294.     ; *** Please read the autodocs to get more details
  295.     
  296.     ; *** The functions marked with a * should not be used anymore
  297.  
  298. MAKE_REL_REFS:MACRO
  299.     DEF_\1_REL    GetSR,0            ; returns SR in D0
  300.     DEF_\1_REL    GoECS,1            ; resets sprite aspect/playfield/goes 15KHz (dummy)
  301.     DEF_\1_REL    GetAttnFlags,2        ; gets system backuped AttnFlags, at any time
  302.     DEF_\1_REL    ResetDisplay,3        ; switches in PAL or NTSC if specified
  303.     DEF_\1_REL    ResetSprites,4        ; resets sprite aspect, useless, dummy!
  304.     DEF_\1_REL    BlackScreen,5        ; sets all color registers to black
  305.     DEF_\1_REL    JoypadState,6        ; to check the state of joystick/joypad
  306.     DEF_\1_REL    InitTrackDisk,7        ; returns a fake disk IO pointer in A1
  307.     DEF_\1_REL    TrackLoad,8        ; simulates DoIO()
  308.     DEF_\1_REL    TrackLoadFast,9        ; * same routine. Please use the TrackLoad name
  309.     DEF_\1_REL    SetTDUnit,10        ; sets drive unit in D0 (for DoIO emulation)
  310.     DEF_\1_REL    SetDisk,11        ; sets current disk (useful with HDLOAD)
  311.     DEF_\1_REL    ReadRobSectors,12    ; reads sectors, rob northen interface
  312.     DEF_\1_REL    ReadRobSectorsFast,13    ; * same routine. Use ReadRobSectors instead
  313.     DEF_\1_REL    ReadFile,14        ; reads file, rob northen interface, from RAM or HD
  314.     DEF_\1_REL    ReadFileFast,15        ; reads file, rob northen interface, from RAM only
  315.     DEF_\1_REL    ReadFilePartHD,16    ; partially reads file, modified rob northen interface, from HD only
  316.     DEF_\1_REL    ReadDiskPart,17        ; reads parts of a disk, from RAM or HD (LOWMEM decides)
  317.     DEF_\1_REL    ReadFileHD,18        ; reads file, rob northen interface, from HD only
  318.     DEF_\1_REL    WriteFileHD,19        ; writes file on HD during game
  319.     DEF_\1_REL    DeleteFileHD,20        ; deletes file from HD during game (careful :-))
  320.     DEF_\1_REL    PPDecrunch,21        ; decrunches PowerPacker files/blocks
  321.     DEF_\1_REL    ImploderDecrunch,22    ; decrunches Imploder files/blocks
  322.     DEF_\1_REL    ATNDecrunch,23        ; decrunches ATN! files/blocks
  323.     DEF_\1_REL    RNCDecrunch,24        ; decrunches RNC\01,\02 files/blocks
  324.     DEF_\1_REL    FungusDecrunch,25    ; decrunches Gremlins packer files/blocks
  325.     DEF_\1_REL    RNCDecrunchEncrypted,26    ; decrunches RNC/01 encrypted files/blocks
  326.     DEF_\1_REL    RNCLength,27        ; gives the length of decunched RNC file
  327.     DEF_\1_REL    FlushCachesHard,28    ; flushes all caches
  328.     DEF_\1_REL    WaitBlit,29        ; waits till blitter operation is complete
  329.     DEF_\1_REL    BeamDelay,30        ; waits using $DFF006 register (beam)
  330.     DEF_\1_REL    InGameOSCall,31        ; calls a user OS routine during the game
  331.     DEF_\1_REL    PatchExceptions,32    ; *priv* install JOTD exception handler (only exceptions)
  332.     DEF_\1_REL    StrcmpAsm,33        ; compares 2 strings (null termintated). Not case sensitive
  333.     DEF_\1_REL    StrcpyAsm,34        ; copies a string (null terminated)
  334.     DEF_\1_REL    StrlenAsm,35        ; returns length of a string (ends with null)
  335.     DEF_\1_REL    ToUpperAsm,36        ; converts a string in upper case
  336.     DEF_\1_REL    WaitMouse,37        ; waits for LMB to be pressed. Colors fill the screen
  337.     DEF_\1_REL    WaitMouseInterrupt,38    ; same thing but interrupts are enabled (HRTMon)
  338.     DEF_\1_REL    GetDiskPointer,39    ; gets start of the specified diskfile (D0) (can be avoided)
  339.     DEF_\1_REL    CheckAGA,40        ; checks if the computer is AGA using DeniseId
  340.     DEF_\1_REL    SetExitRoutine,41    ; to call a user routine just before exit
  341.     DEF_\1_REL    InGameExit,42        ; exits to WB from game at any time
  342.     DEF_\1_REL    SaveCustomRegs,43    ; *priv* saves important custom registers
  343.     DEF_\1_REL    RestoreCustomRegs,44    ; *priv* restores them
  344.     DEF_\1_REL    SaveCIARegs,45        ; *priv* saves all CIA info possible and LED state
  345.     DEF_\1_REL    RestoreCIARegs,46    ; *priv* restores them
  346.     DEF_\1_REL    FreezeAll,47        ; clears all ints, dma...
  347.     DEF_\1_REL    ReadUserFileHD,48    ; reads file, from HD in user SAVEDIR directory
  348.     DEF_\1_REL    WriteUserFileHD,49    ; writes file on HD in user SAVEDIR directory
  349.     DEF_\1_REL    DeleteUserFileHD,50    ; removes file from HD in user SAVEDIR directory
  350.     DEF_\1_REL    TPWMDecrunch,51        ; decrunches TPWM files/blocks (experimental)
  351.     DEF_\1_REL    WaitBOF,52        ; waits bottom of frame, hardware coded. not working, useless
  352.     DEF_\1_REL    ReadUserDir,53        ; reads user directory in a robdir structure
  353.     DEF_\1_REL    PatchZeroPage,54    ; *priv* install JOTD exception handler (done in SaveOSData)
  354.     DEF_\1_REL    FireDecrunch,55        ; decrunch FIRE packer files/blocks
  355.     DEF_\1_REL    HexReplaceLong,56    ; search/replace a longword in a zone
  356.     DEF_\1_REL    HexReplaceWord,57    ; search/replace a word in a zone
  357.     DEF_\1_REL    HexToDecString,58    ; converts hexadecimal to decimal string
  358.     DEF_\1_REL    GetUserData,59        ; returns userdata string
  359.     DEF_\1_REL    StrncpyAsm,60        ; strncpy, D2 limits string length
  360.     DEF_\1_REL    PatchMoveCList_Idx,61    ; patches move.l #adr,($80,Ax) 
  361.     DEF_\1_REL    StoreCopperPointer,62    ; stores manually copper address
  362.     DEF_\1_REL    TellCopperPointer,63    ; returns previously stored copper address
  363.     DEF_\1_REL    InGameIconify,64    ; iconifies the game
  364.     DEF_\1_REL    PatchMoveCList_Abs,65    ; patches move.l #adr,($DFF080) 
  365.     DEF_\1_REL    PatchMoveCList_Ind,66    ; patches move.l adr,($DFF080) 
  366.     DEF_\1_REL    LogPatch,67        ; store before-patch information
  367.     DEF_\1_REL    PatchMoveBlit_Idx,68    ; patches move.w #blit,($58,Ax)
  368.     DEF_\1_REL    HexToString,69        ; hex to string conversion
  369.     DEF_\1_REL    IsRegistered,70        ; check to see if JST is registered
  370.     DEF_\1_REL    SetQuitKey,71        ; set the key for auto quit
  371.     DEF_\1_REL    SetIconifyKey,72    ; set the key for auto iconify
  372.     DEF_\1_REL    ReadFilePart,73        ; partially reads file, modified rob northen interface
  373.     DEF_\1_REL    StrncmpAsm,74        ; partially compares 2 strings UC=LC
  374.     DEF_\1_REL    CRC16,75        ; calculates CRC16 for a block
  375.     DEF_\1_REL    TSMDecrunch,76        ; decrunches a TSM! file, not working!
  376.     DEF_\1_REL    EnterDebugger,77    ; enter your Debugger/Freezer if any present
  377.     DEF_\1_REL    ReadFileFromImage,78    ; Load a file from a "DOS\0" image
  378.     DEF_\1_REL    EnableMMU,79        ; *priv* Enable the MMU translation
  379.     DEF_\1_REL    DisableMMU,80        ; *priv* Disable the MMU translation
  380.     DEF_\1_REL    SetTraceVector,81    ; Modifies trace vector ($24.W+VBR)
  381.     DEF_\1_REL    GetUserFlags,82        ; Gets some of the user tooltypes
  382.     DEF_\1_REL    InstallHarryOSEmu,83    ; *priv* do not use
  383.     DEF_\1_REL    AddPart,84        ; concatenates dirname[/:]filename
  384.     DEF_\1_REL    CopyMem,85        ; copies memory
  385.     DEF_\1_REL    RelocateExecutable,86    ; relocates executable
  386.     DEF_\1_REL    ExeSegmentLength,87    ; calculates executable filesize
  387.     DEF_\1_REL    ExeMappedLength,88    ; calculates expanded size in memory
  388.     DEF_\1_REL    OSEmuRelocate,89    ; relocates executable, with allocation
  389.     DEF_\1_REL    HexSearch,90        ; memory search
  390.     DEF_\1_REL    SkipColon,91        ; skips ':' in file names
  391.     DEF_\1_REL    RestoreCustomNoDMA,92    ; *priv*
  392.  
  393.     DEF_\1_REL    SetRTFileError,93    ; sets/disables runtime file error
  394.     DEF_\1_REL    Unsupported3,94        ; future use
  395.     DEF_\1_REL    Unsupported4,95        ; future use
  396.     DEF_\1_REL    Unsupported5,96        ; future use
  397.     DEF_\1_REL    Unsupported6,97        ; future use
  398.     DEF_\1_REL    Unsupported7,98        ; future use
  399.     DEF_\1_REL    Unsupported8,99        ; future use
  400.     DEF_\1_REL    Unsupported9,100    ; future use
  401.     
  402.     ENDM
  403.  
  404. DEF_OFFSET_ABS:MACRO
  405. AbsOff_\1 = \2*4
  406.     ENDM
  407.  
  408. DEF_OFFSET_REL:MACRO
  409. RelOff_\1 = \2*4
  410.     ENDM
  411.  
  412. DEF_ADDR_ABS:MACRO
  413. AbsAdd_\1:
  414.     dc.l    AbsFun_\1
  415.     ENDM
  416.  
  417. DEF_ADDR_REL:MACRO
  418.     XDEF    RelFun_\1
  419. RelAdd_\1:
  420.     dc.l    RelFun_\1
  421.     ENDM
  422.  
  423.  
  424. RELOC_CLRL:MACRO
  425.     IFNE    NARG-1
  426.         FAIL    arguments "RELOC_CLRL"
  427.     ENDC
  428.  
  429.     RELOC_MOVEL    #0,\1
  430.     ENDM
  431.  
  432. RELOC_CLRW:MACRO
  433.     IFNE    NARG-1
  434.         FAIL    arguments "RELOC_CLRW"
  435.     ENDC
  436.  
  437.     RELOC_MOVEW    #0,\1
  438.     ENDM
  439.  
  440. RELOC_CLRB:MACRO
  441.     IFNE    NARG-1
  442.         FAIL    arguments "RELOC_CLRB"
  443.     ENDC
  444.  
  445.     RELOC_MOVEB    #0,\1
  446.     ENDM
  447.  
  448. RELOC_STL:MACRO
  449.     IFNE    NARG-1
  450.         FAIL    arguments "RELOC_STL"
  451.     ENDC
  452.  
  453.     RELOC_MOVEL    #-1,\1
  454.     ENDM
  455.  
  456. RELOC_STW:MACRO
  457.     IFNE    NARG-1
  458.         FAIL    arguments "RELOC_STW"
  459.     ENDC
  460.  
  461.     RELOC_MOVEW    #-1,\1
  462.     ENDM
  463.  
  464. RELOC_STB:MACRO
  465.     IFNE    NARG-1
  466.         FAIL    arguments "RELOC_STB"
  467.     ENDC
  468.  
  469.     RELOC_MOVEB    #-1,\1
  470.     ENDM
  471.  
  472. RELOC_MOVEL:MACRO
  473.     IFNE    NARG-2
  474.         FAIL    arguments "RELOC_MOVEL"
  475.     ENDC
  476.  
  477.     movem.l    D0/A6,-(sp)
  478.     lea    \2(pc),A6
  479.     move.l    \1,(A6)
  480.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  481.     ENDM
  482.  
  483. RELOC_MOVEW:MACRO
  484.     IFNE    NARG-2
  485.         FAIL    arguments "RELOC_MOVEW"
  486.     ENDC
  487.  
  488.     movem.l    A6/D0,-(sp)
  489.     lea    \2(pc),A6
  490.     move.w    \1,(A6)
  491.     movem.l    (sp)+,D0/A6
  492.     ENDM
  493.  
  494. RELOC_MOVEB:MACRO
  495.     IFNE    NARG-2
  496.         FAIL    arguments "RELOC_MOVEB"
  497.     ENDC
  498.  
  499.     movem.l    A6/D0,-(sp)
  500.     lea    \2(pc),A6
  501.     move.b    \1,(A6)
  502.     movem.l    (sp)+,D0/A6
  503.     ENDM
  504.  
  505. RELOC_ADDL:MACRO
  506.     IFNE    NARG-2
  507.         FAIL    arguments "RELOC_ADDL"
  508.     ENDC
  509.  
  510.     movem.l    D0/A6,-(sp)
  511.     lea    \2(pc),A6
  512.     add.l    \1,(A6)
  513.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  514.     ENDM
  515.  
  516. RELOC_ADDW:MACRO
  517.     IFNE    NARG-2
  518.         FAIL    arguments "RELOC_ADDW"
  519.     ENDC
  520.  
  521.     movem.l    A6/D0,-(sp)
  522.     lea    \2(pc),A6
  523.     add.w    \1,(A6)
  524.     movem.l    (sp)+,D0/A6
  525.     ENDM
  526.  
  527. RELOC_ADDB:MACRO
  528.     IFNE    NARG-2
  529.         FAIL    arguments "RELOC_ADDB"
  530.     ENDC
  531.  
  532.     movem.l    A6/D0,-(sp)
  533.     lea    \2(pc),A6
  534.     add.b    \1,(A6)
  535.     movem.l    (sp)+,D0/A6
  536.     ENDM
  537.  
  538.  
  539. RELOC_SUBL:MACRO
  540.     IFNE    NARG-2
  541.         FAIL    arguments "RELOC_SUBL"
  542.     ENDC
  543.  
  544.     movem.l    D0/A6,-(sp)
  545.     lea    \2(pc),A6
  546.     sub.l    \1,(A6)
  547.     movem.l    (sp)+,D0/A6    ; movem preserves flags
  548.     ENDM
  549.  
  550. RELOC_SUBW:MACRO
  551.     IFNE    NARG-2
  552.         FAIL    arguments "RELOC_SUBW"
  553.     ENDC
  554.  
  555.     movem.l    A6/D0,-(sp)
  556.     lea    \2(pc),A6
  557.     sub.w    \1,(A6)
  558.     movem.l    (sp)+,D0/A6
  559.     ENDM
  560.  
  561. RELOC_SUBB:MACRO
  562.     IFNE    NARG-2
  563.         FAIL    arguments "RELOC_SUBB"
  564.     ENDC
  565.  
  566.     movem.l    A6/D0,-(sp)
  567.     lea    \2(pc),A6
  568.     sub.b    \1,(A6)
  569.     movem.l    (sp)+,D0/A6
  570.     ENDM
  571.  
  572. RELOC_TSTL:MACRO
  573.     IFNE    NARG-1
  574.         FAIL    arguments "RELOC_TSTL"
  575.     ENDC
  576.  
  577.     movem.l    D0/A0,-(sp)
  578.     lea    \1(pc),A0
  579.     tst.l    (A0)
  580.     movem.l    (sp)+,D0/A0
  581.     ENDM
  582.  
  583. RELOC_TSTW:MACRO
  584.     IFNE    NARG-1
  585.         FAIL    arguments "RELOC_TSTW"
  586.     ENDC
  587.  
  588.     movem.l    D0/A0,-(sp)
  589.     lea    \1(pc),A0
  590.     tst.w    (A0)
  591.     movem.l    (sp)+,D0/A0
  592.     ENDM
  593.  
  594. RELOC_TSTB:MACRO
  595.     IFNE    NARG-1
  596.         FAIL    arguments "RELOC_TSTB"
  597.     ENDC
  598.  
  599.     movem.l    D0/A0,-(sp)
  600.     lea    \1(pc),A0
  601.     tst.b    (A0)
  602.     movem.l    (sp)+,D0/A0
  603.     ENDM
  604.  
  605.     ; *** builds the function offsets
  606.  
  607.     MAKE_ABS_REFS    OFFSET
  608.     MAKE_REL_REFS    OFFSET
  609.  
  610. HDP_SAFETY = $00
  611. HDP_MAGIC = $04
  612. HDP_VERSION = $08
  613. HDP_ABSTABLE = $0C
  614. HDP_RELTABLE = $10
  615. HDP_FILESIZE = $14
  616. HDP_NBDISKS = $18
  617. HDP_ENTRY = $1C
  618. HDP_FNAME = $20
  619. HDP_SYSBASE = $24
  620. HDP_DOSBASE = $28
  621.     ENDC
  622.